
import { Component, OnInit } from '@angular/core';
import {FooterService} from '../pages/services/footer.service';
import {MenuService} from '../pages/services/menu.service';
import {LogoService} from '../pages/services/logo.service';
import {NotificationsService} from '../pages/services/notifications.service';
import {MessagesService} from '../pages/services/messages.service';
import {User} from '../pages/models/user';
import {Message} from '../pages/models/message';
import {MenuAsideComponent} from '../pages/widgets/menu-aside/menu-aside.component';
import {Notification} from '../pages/models/notification';
import {UserService} from '../pages/services/user.service';
import {TranslateService} from '@ngx-translate/core';


@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {
  // define your footer links
  private footer = {
    left_part: `<strong>
        Copyright &copy; 2017
        <a href="http://www.weberantoine.fr" >WEBER Antoine</a>.
    	</strong>
      Open-source Sharing`,
    right_part: 'Admin-LTE',
  };
  // define here your own links menu structure
  private mylinks: any = [
    {
      'header': '菜单'
    },
    {
      'title': '首页',
      'icon': 'dashboard',
      'link': ['/home'],
    },
    {
      'title': '看板',
      'icon': 'th',
      'sublinks': [
        {
          'title': 'Page 2',
          'icon': 'genderless',
          'link': ['#'],
          'sublinks': [
            {
              'title': 'Page 2',
              'link': ['/page/1'],
              'icon': 'genderless'
            },
            {
              'title': 'Page 3',
              'link': ['/page/2'],
              'icon': 'genderless'
            }
          ]
        }
      ]
    },
    {
      'title': '我的看板',
      'icon': 'th',
      'sublinks': [
        {
          'title': '看板一',
          'link': ['/page/3'],
          'icon': 'genderless'
        },
        {
          'title': '看板二',
          'link': ['/page/4'],
          'external': false,
          'icon': 'genderless'
        }
      ]
    },
    {
      'title': '配置',
      'icon': 'gear',
      'sublinks': [
        {
          'title': '数据源管理',
          'link': ['/page/5'],
          'icon': 'genderless'
        },
        {
          'title': '数据集管理',
          'link': ['/page/6'],
          'icon': 'genderless'
        },
        {
          'title': '图表设计',
          'link': ['/page/7'],
          'icon': 'genderless'
        },
        {
          'title': '看板设计',
          'link': ['/page/8'],
          'icon': 'genderless'
        },
        {
          'title': '看板分类',
          'link': ['/page/9'],
          'icon': 'genderless'
        },
        {
          'title': '资源分享',
          'link': ['/page/10'],
          'icon': 'genderless'
        }
      ]
    },
    {
      'title': '管理',
      'icon': 'gear',
      'sublinks': [
        {
          'title': '用户管理',
          'link': ['/admin/user'],
          'icon': 'genderless'
        },
        {
          'title': '认证源管理',
          'link': ['/page/11'],
          'icon': 'genderless'
        }
      ]
    },
    // external widget
    {
      class: MenuAsideComponent,
      data: {
        label: 'test component'
      }
    }
  ];
  // define here your logo
  private logo = {
    html_mini: '<i class="fa fa-home"></i>',
    html_lg: '<b>SB</b>oard',
  };

  constructor(
    private footerServ: FooterService,
    private menuServ: MenuService,
    private logoServ: LogoService,
    private msgServ: MessagesService,
    private userService: UserService,
    private notifServ: NotificationsService,
    translate: TranslateService
  ) {
// this language will be used as a fallback when a translation isn't found in the current language
    translate.setDefaultLang('zh');

    // the lang to use, if the lang isn't available, it will use the current loader to get them
    translate.use('zh');
  }

  public ngOnInit() {
    // define menu
    this.menuServ.setCurrent(this.mylinks);
    this.footerServ.setCurrent(this.footer);
    this.logoServ.setCurrent(this.logo);

    // FAKE MESSAGE
    // defining some test users
    // const user1 = new User( {
    //   avatarUrl: 'assets/img/user2-160x160.jpg',
    //   email: 'weber.antoine.pro@gmail.com',
    //   firstname: 'WEBER',
    //   lastname: 'Antoine',
    //   connected: true
    // });
    // this.userService.setCurrent(user1);
    // const user2 = new User( {
    //   avatarUrl: 'assets/img/user2-160x160.jpg',
    //   email: 'EMAIL',
    //   firstname: 'FIRSTNAME',
    //   lastname: 'LASTNAME'
    // });
    // // sending a test message
    // this.msgServ.addMessage( new Message( {
    //   author: user2,
    //   content: 'le contenu d\'un message d\'une importance extreme',
    //   destination: user1,
    //   title: 'un message super important'
    // }) );
    // // sending a test notif
    // this.notifServ.addNotification( new Notification( {
    //   class: 'fa fa-users text-aqua',
    //   content: '5 new members joined today',
    //   link: '/page/2'
    // }) );


  }

}

